package com.example.controller;

import com.example.entity.PageBean;
import com.example.entity.Result;
import com.example.entity.dto.EmpDto;
import com.example.entity.dto.EmpLoginDto;
import com.example.entity.pojo.Emp;
import com.example.mapper.EmpMapper;
import com.example.service.EmpService;
import com.example.utils.MyThreadLocalUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 员工管理
 */
@RestController
public class EmpController {
    @Autowired
    private EmpService empService;

    @GetMapping("/emps")
    public Result<PageBean<Emp>> getByPage(@RequestParam(defaultValue = "1") Integer pageNum,
                                           @RequestParam (defaultValue = "5") Integer pageSize,
                                           EmpDto empDto
    ) {
        PageBean<Emp> pageBean = empService.getByPage(pageNum, pageSize, empDto);
        Map<String, Object> map = MyThreadLocalUtils.getValue();
        System.out.println("从ThreadLocal中获取的令牌解析的结果是============================"+ map);
        return Result.ok(pageBean);
    }



}
